<template>
  <div>
    <nav-top />
    <div class="banner">
        <img class="ban" :src="goodsInfo.pic" alt="" />
        <div class="nav">
          <img src="@/assets/images/2.png" />
          <span class="dec">全天销量榜第 名</span>
          <span class="time">近24小时，{{goodsInfo.xiaoliang}}人已抢</span>
        </div>
        <div class="picnav">
          <span class="pic">￥{{goodsInfo.jiage}}</span>
          <del>原价 ￥{{goodsInfo.yuanjia}}</del>
          <span class="buy"
            >已售<span>{{goodsInfo.dsr}}万</span
            >件</span
          >
        </div>
        <div class="title">
          <img src="@/assets/images/3.png" alt="" />
          <span>{{goodsInfo.d_title}}</span>
        </div>
        <div class="quan">
          <div class="left">
            <div class="yuan">￥{{goodsInfo.jiage}}</div>
            <div class="limit">
              <span>优惠券使用期限</span>
              <span>2021.07.03-2021.07.05</span>
            </div>
          </div>
          <div class="right">立即领券</div>
        </div>
        <div class="recommend">
          <div class="topleft">
            <img src="@/assets/images/4.png" alt="" />
            <span class="people">达人推荐</span>
          </div>
          <span class="share">{{goodsInfo.today_sellnum}}次分享</span>
          <div class="talk">
            {{goodsInfo.miaoshu}}
          </div>
        </div>
        <div class="shop">
          <img src="@/assets/images/5.jpg" alt="" />
          <div class="shopTitle">
            <div class="top">
              <span class="name">{{goodsInfo.shop_name}}</span>
              <div class="btn">
                <span class="one">进店逛逛</span>
                <span class="two">全部商品</span>
              </div>
            </div>
            <div class="dec">
              <span class="miao">
                描述：4.8
                <i class="height">高</i>
              </span>
              <span class="mai">
                卖家：4.8
                <i class="height">高</i>
              </span>
              <span class="wu">
                物流：4.8
                <i class="height">高</i>
              </span>
            </div>
          </div>
        </div>
        <div class="detail">
          <span class="goods">商品详情</span>
          <div class="right">
            <span class="open">展开</span>
            <span class="iconfont icon-down-circle"></span>
          </div>
        </div>
        <div class="listTitle">
          <span class="iconfont icon-aixin"></span>
          <span>为你推荐</span>
        </div>
      </div>

        <rec-list :data="recInfo"></rec-list>
        <page-footer></page-footer>
    </div>
</template>

<script>
import "@/assets/css/reset.css";
import { getGoods } from "@/api/detail";
import {  getRec } from "@/api/detail";
import NavTop from "../detail/ui/navTop.vue";
import recList from '../recommendList/index.vue'
import Loading from '@/components/common/loading/loading.vue';
import pageFooter from '@/components/common/pageFooter'
export default {
  components: {
    NavTop,
    recList,
    Loading,
    pageFooter
  },
  data() {
    return {
      goodsInfo: {},
      rets:[],
      recInfo:[],
    };
  },
  async mounted() {
    let ret = await getGoods(this.$route.params.id);
    let data = await getRec(this.$route.params.id);
    console.log(data.data);
    this.recInfo = data.data

    // console.log(ret.data);
    this.rets = ret.data.content;
    // console.log(this.rets);

    this.rets.forEach((item,index)=>{
      this.goodsInfo = this.rets[0];
    })
  },
};
</script>

<style lang="scss" scoped>
.banner {
  background: #f6f6f6;
}
.banner .ban {
  width: 100%;
}
.nav {
  width: 100%;
  height: 60px;
  // background: violet;
  line-height: 60px;
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  // background-image: url("@/assets/img/1.png");
  background: #fff;
}
.nav img {
  width: 69px;
  height: 17px;
  margin-top: 20px;
}
.nav .dec {
  color: rgba(255, 87, 33, 1);
}
.nav .time {
  color: #999999;
}
.picnav {
  width: 100%;
  height: 60px;
  line-height: 60px;
  background: #fff;
}
.picnav .pic {
  font-size: 20px;
  color: #f91415;
  margin-left: 15px;
  margin-right: 15px;
  font-weight: bold;
}
.picnav del {
  color: #888;
}
.picnav .buy {
  float: right;
  margin-right: 20px;
  color: #888;
}
.picnav .buy span {
  color: #f91415;
}
.title {
  height: 40px;
  line-height: 40px;
  padding-left: 20px;
  font-size: 15px;
  background: #fff;
  // background: #888;
}
.title span {
  margin-left: 10px;
  color: #333;
}
.quan {
  width: 95%;
  height: 65px;
  margin: 10px 10px;
  display: flex;
  flex-direction: row;
  color: #ff313e;
  // background: thistle;
  background: linear-gradient(270deg, #fee 0, #ffe2e8 100%);
  border-radius: 10px;
  box-sizing: border-box;
}
.quan .left {
  width: 500px;
  height: 100%;
  display: flex;
  flex-direction: row;
  // background: tomato;
}
.quan .left .yuan {
  width: 80px;
  height: 100%;
  font-size: 25px;
  line-height: 65px;
  margin-left: 20px;
}
.quan .left .limit {
  padding-top: 15px;
}
.quan .left .limit span {
  display: block;
  margin-bottom: 10px;
}
.quan .right {
  width: 200px;
  height: 100%;
  line-height: 65px;
  font-size: 15px;
  text-align: center;
  border-left: 2px dashed #fff;
  // background: turquoise;
}
.recommend {
  width: 100%;
  height: 200px;
  // background: cornflowerblue;
  background: #fff;
  border-radius: 10px;
}
.recommend .topleft {
  margin-left: 30px;
  height: 80px;
  line-height: 80px;
  float: left;
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  // background: cyan;
}
.recommend .topleft img {
  width: 30px;
  height: 30px;
  margin-top: 23px;
  margin-right: 10px;
}
.recommend .share {
  float: right;
  height: 80px;
  line-height: 80px;
  color: #666;
  margin-right: 20px;
}
.people {
  color: #fe3738;
  font-size: 16px;
}
.talk {
  height: 100px;
  background: #f4f4f4;
  border-radius: 10px;
  margin: 20px 10px;
  position: relative;
  color: #555;
  font-size: 14px;
  line-height: 25px;
  clear: both;
}
.talk::after {
  content: "";
  width: 0;
  height: 0;
  position: absolute;
  top: -20px;
  left: 100px;
  border-bottom: 24px solid #f4f4f4;
  border-right: 40px solid #fff;
  z-index: 8;
  transform: rotate(-10deg);
}
.shop {
  width: 100%;
  height: 100px;
  display: flex;
  flex-direction: row;
  background: #fff;
  border-radius: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
}
.shop img {
  width: 50px;
  height: 50px;
  margin-top: 30px;
  margin-left: 10px;
}
.shopTitle {
  // background: greenyellow;
  width: 400px;
  padding-left: 10px;
}
.shopTitle .top {
  height: 40px;
  // background: hotpink;
}
.shopTitle span.name {
  float: left;
  font-size: 15px;
  margin-top: 20px;
}
.shopTitle .btn {
  float: right;
  display: flex;
}
.shopTitle .btn span {
  margin-top: 20px;
  height: 20px;
  width: 60px;
  text-align: center;
  line-height: 20px;
  border-radius: 20px;
}
.shopTitle .btn span.one {
  margin-right: 10px;
  border: 1px solid #fe3738;
  color: #fe3738;
}
.shopTitle .btn span.two {
  border: 1px solid #fe3738;
  color: #fff;
  margin-right: 10px;
  background: #fe3738;
}
.shopTitle .dec {
  width: 300px;
  height: 40px;
  line-height: 40px;
  position: relative;
}
.shopTitle .dec span.miao {
  color: #888;
  position: absolute;
  // margin-right: 10px;
}
.shopTitle .dec span.mai {
  color: #888;
  position: absolute;
  left: 80px;
  // margin-right: 10px;
}
.shopTitle .dec span.wu {
  color: #888;
  position: absolute;
  left: 160px;
  // margin-right: 10px;
}
.shopTitle .dec span i {
  background: #fa2435;
  color: #fff;
  border-radius: 3px;
}
.detail {
  width: 100%;
  height: 60px;
  line-height: 60px;
  // background: cornflowerblue;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 20px;
}
.detail span.goods {
  font-size: 15px;
  color: #333;
  margin-left: 15px;
}
.detail .right {
  float: right;
  margin-right: 15px;
}
.detail .right span.open {
  margin-right: 10px;
}
.detail .right span.iconfont {
  font-size: 15px;
  color: red;
}
.listTitle {
  width: 100%;
  height: 40px;
  line-height: 40px;
  text-align: center;
  font-size: 20px;
  // background: rosybrown;
}
.listTitle .iconfont {
  color: rgb(252, 64, 127);
  font-size: 20px;
  margin-right: 10px;
}
</style>